import 'package:flutter/material.dart';

import 'package:top_foundation/utils/theme/theme.dart';

import '../../../../helper/utils/util.dart';
import 'index.dart';

class ValidateAccountPage extends GetView<ValidateAccountController> {
  const ValidateAccountPage({Key? key}) : super(key: key);

  Widget _buildItem(String title, String data) {
    return Padding(
      padding: EdgeInsets.only(bottom: 10.r),
      child: Column(
        children: [
          Row(
            children: [
              Container(
                width: 10.r,
                height: 10.r,
                margin: EdgeInsets.only(right: 8.r),
                decoration: BoxDecoration(
                  color: ITheme.selectedColor,
                  borderRadius: BorderRadius.circular(5),
                ),
              ),
              Expanded(
                child: Text(
                  title,
                  style: ITheme.text.titleMedium,
                ),
              ),
            ],
          ),
          Padding(
            padding: EdgeInsets.only(left: 18.r, top: 10.r),
            child: Text(
              data,
              style: ITheme.text.subtitle15,
            ),
          ),
        ],
      ),
    );
  }

  // 主视图
  Widget _buildView() {
    var appName = '互联网+平时考核';
    return ListView(
      padding: EdgeInsets.symmetric(horizontal: 12.r),
      shrinkWrap: true,
      children: [
        Container(
          alignment: Alignment.center,
          height: 44.r,
          child: Text(
            '注销须知',
            style: ITheme.text.titleLarge,
          ),
        ),
        Container(
          alignment: Alignment.center,
          padding: EdgeInsets.only(bottom: 10.r),
          child: Text(
            '在你提交注销申请之前，请先确认以下信息，以保证你的账号安全:',
            style: ITheme.text.titleMedium,
          ),
        ),
        _buildItem('账号处于安全状态', '账号处于安全状态：账号处于正常使用状态，无被盗风险。'),
        _buildItem('账号信息',
            '账号注销后，您将无法使用$appName，$appName账号的个人资料和历史信息（包括用户名，所有事务记录等）都将无法找回。'),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<ValidateAccountController>(
      builder: (_) {
        return Scaffold(
          appBar: detailAppBar(context, title: '注销账号'),
          body: Column(
            children: [
              Expanded(child: _buildView()),
              BottomBar(children: [
                Expanded(
                  child: Padding(
                    padding: EdgeInsets.symmetric(horizontal: 16.r),
                    child: TextBtn(
                      onTap: controller.actionNext,
                      bgColor: Colors.redAccent,
                      title: '下一步',
                    ),
                  ),
                )
              ])
            ],
          ),
        );
      },
    );
  }
}
